package com.preskool.service.impl;

import com.preskool.service.EventsService;
import com.preskool.mapper.EventsMapper;
import com.preskool.po.Events;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Auther
 * @Date
 */
@Service
public class EventsServiceImpl implements EventsService {
    @Autowired(required = false)
    private EventsMapper eventsMapper;

    //通过id查询单条信息
    @Override
    public Events selectEventsById(Integer id) {
        Events event = eventsMapper.selectByPrimaryKey(id);
        if (event!=null){
            return event;
        }else{
            return null;
        }
    }

    //添加大事记
    @Override
    public Boolean addEvents(Events events) {
        int i = eventsMapper.insertSelective(events);
        if (i>0){
            return true;
        }else{
            return false;
        }
    }

    //删除大事记
    @Override
    public Boolean deleteEvents(Integer id) {
        int i = eventsMapper.deleteByPrimaryKey(id);
        if (i>0){
            return true;
        }else{
            return false;
        }
    }

    //修改大事记
    @Override
    public Boolean updateEvents(Events events) {
        int i = eventsMapper.updateByPrimaryKeySelective(events);
        if (i>0){
            return true;
        }else{
            return false;
        }
    }


}
